<style>
    .doc-container {
        margin-top: 50px;
        background-color: #FFFFFF;
        border-radius: 10px;
    }
    .doc-title {
        padding-top: 30px;
        text-align: center;
    }
    .doc-info {
        padding: 0 20px;
        text-align: center;
    }
    .doc-content {
        padding: 30px;
    }
</style>
<div class="doc-container">
    <div>
        <h4 id="doc-title" class="doc-title">加载中</h4>
    </div>
    <div class="doc-info" id="doc-info">
        <p>加载中</p>
    </div>
    <hr>
    <div class="doc-content" id="show-content">

    </div>
</div>
<script language="JavaScript">
    $(function () {
        <% if (parseInt(hideNav) === 1) { %>
            let node = $('body > .container')[0];
            node.parentNode.removeChild(node);

            $('.doc-container').css('margin-top',0);
        <% } %>

        docId = null;
        <% if (docId) { %>
        docId = "<%=docId %>";
        $.get('/ueditor/detail',{id:docId},function (data) {
            if (data.code === 0) {
                let doc = data.data;
                if (doc.content.indexOf('ipack://') === 0) {
                    let content = doc.content.replace(/ipack:\/\//,'/');
                    window.location.href = content;
                    return;
                }
                var docNode = document.createElement('div');
                docNode.innerHTML = doc.content;
                var parent = document.getElementById('show-content');
                parent.appendChild(docNode);

                $('#doc-title').text(doc.name);
                $('#doc-info').text(doc.updateUser.nickname + '于' + doc.updateTime + '更新');
            } else {
                showError('未知错误');
                docId = null;
            }
        });
        <% } %>
    });
</script>